<?php namespace Common\Model;
use Hdphp\Model\Model;
class GoodsList extends Model{
	protected $table='goods_list';
//	protected $validate=array(
//		array('gn','required','货号不能为空',3,3),
//	);


	public function addData($gid){
		//*验证
		$combine=implode(',', Q('post.gtid'));
		sp($combine);die;
		
		$data=array(
			'combine'=>$combine,
			'number'=>Q('post.number',''),//货号
			'inventory'=>Q('post.inventory',0,'intval'),//库存
			'goods_gid'=>$gid,
		);
		$this->add($data);//添加数据
		return true;
	}






	public function editData($gid,$glid){
	    $combine=implode(',', Q('post.a'));
		//sp($glid);die;
		//p($combine);die;
		$data=array(
			'combine'=>$combine,
			'number'=>Q('post.number',''),//货号
			'inventory'=>Q('post.inventory',0,'intval'),//库存
			'goods_gid'=>$gid,
		);
		//sp($data);die;
		$this->where('glid',$glid)->update($data);//添加数据
		return true;
	}

}
 ?>